/**
 * @author BelovedLYC
 * @date 2025-06-01
 * @description 获取二维码状态
 */

import request from "../request";
import type { ApiResponse } from "../request";
import {
  getDeviceId,
  getDeviceName,
  getDeviceType,
} from "../../utils/deviceInfo";
export interface QrCodeLoginResponse {
  data: {
    qrId: string;
    status: number;
    type: number;
    device: {
      deviceName: string;
      deviceType: number;
    };
  };
  createTime: string;
  expireTime: string;
  location?: string;
}
export const getLoginQrCodeRequest = async (): Promise<
  ApiResponse<QrCodeLoginResponse>
> => {
  return await request.get(`/user/login/qrcode/generate`, {
    headers: {
      "X-Device-Id": getDeviceId(),
      "X-Device-Name": getDeviceName(),
      "X-Device-Type": getDeviceType().toString(),
    },
  });
};
